package com.zhouyipeng;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 并行流
 *
 * @author zhouyipeng
 * @since 2022-01-27
 */
public class ParallelStream {

   static List<Integer> list = new ArrayList<>();

    public static void main(String[] args) {
            for (int i = 0; i <100 ; i++) {
                list.add(i);
        }

        long l = System.currentTimeMillis();
//            list.stream().forEach(System.out::println);
        list.parallelStream().forEach(System.out::println);
        long l1 = System.currentTimeMillis();
        System.out.println("time"+ (l1 -l));
    }

}
